<template>
	<div class="scoreCon" id="finalQues">
		<div id="finalQues_a">
			<div>
				<p class="score">{{ data.score }}</p>
				<p class="desc">{{ data.title }}</p>
			</div>
		</div>
		<h1 id="finalQues_b">
			用时
			<span>{{ data.duration }}分钟</span>
		</h1>
		<ul id="finalQues_c">
			<li>
				<p class="success">{{ data.rightsquescou }}</p>
				<p>答对</p>
			</li>
			<li class="ml">
				<p class="danger">{{ data.errorsquescou }}</p>
				<p>答错</p>
			</li>
			<li class="ml">
				<p class="info">{{ data.nansweredsquescou }}</p>
				<p>未答</p>
			</li>
		</ul>
		<ul id="finalQues_d">
			<li @click="viewWrong(0)">
				<img src="../assets/view_wrong.png" />
				查看错题
			</li>
			<li class="ml" @click="viewWrong(1)">
				<img src="../assets/review_paper.png" />
				回顾试卷
			</li>
		</ul>
		<div class="btn btnGrad" v-if="againShow" @click="againBtn(data)">再考一次</div>
	</div>
</template>
<script>
export default {
	props: {
		data: {
			type: Object,
			required: true
		},
		againShow: {
			type: Boolean,
			default: true
		}
	},
	data(){
		return{
			flag: true
		}
	},
	methods: {
		againBtn(data) {
			//再考一次
			const { upid, paperid } = data;
			if(this.flag){
				this.flag = false
				this.axios
					.get('/web/student/home/redoPaper', {
						params: {
							upid,
							paperid
						}
					})
					.then(res => {
						// data.upid=res.upid
						res.restart=1;
						this.$emit('againBtn',res)
					});
					setTimeout(() => {
							this.flag = true
						},5000)
			}
		},
		viewWrong(type){
			this.$emit('viewWrong',type)
		},
	}
};
</script>
<style></style>
